
<script type="text/javascript" src="@{'/public/javascripts/jquery-1.6.4.min.js'}"></script>
<script type="text/javascript">
 //$(function(){
     //$("select:last").change(function(){
     //alert("dd");
         //var listAction = #{jsAction @ProgramaAction.test(':name')/}
        // var id = $("select:last").val();
         //htmlobj = $.ajax({url:@test(),data:name=opt,pass="123"});
        //$("#test").load(listAction({name:opt,pass:"123"}));
           // var areaAction = #{jsAction @test(':id') /};
              // $.get(areaAction({id:id}), function(data) {
              // alert(data);
                  // if(data != ""){
                      
                      //  $.each(data, function(i) {
                        //    alert(data[i]);
                        //});
                        
                    //}
                  // });
     	//});
 //});

function lan(aaa){
        $.ajax({
               type:"POST",
               url:"@{test()}",
               dataType:"json",
               data:"id="+$(aaa).val(),
               success:function(data){
               if(data[0].id != "non"){
                   var opt = "";
	               for(var i=0;i<data.length;i++){
	                  if(opt == ""){
	                    opt = "<option value="+data[i].id+">"+data[i].proName+"</option>";
	                  }else{
	                    opt += "<option value="+data[i].id+">"+data[i].proName+"</option>";
	                  }
	               }
	                 $(aaa).nextAll().remove();
	                 $(aaa).after("&nbsp;&nbsp;<select name='parId' onchange='lan(this);'><option>请选择：</option>"+opt+"</select>");
               }else{
                     $(aaa).nextAll().remove();
               }
               }
        });
 }
</script>
	<link type="text/css" rel="stylesheet" href="@{'/public/indexFile/css/index.css'}" charset="utf-8"/>
<div style="margin:10px auto; width:500px;">
<form action="@{create()}" method="post">
     #{if flash.success}
    <p><font color="red">${flash.success}</font></p>
     #{/if}
	<p style="margin-left:10px;color:#666666;">请选择父栏目：
	<select style="width:170px;" name="parId" onchange="lan(this);">
		     <option value="0">顶级栏目</option>
			#{list items:programas,as:'programa'}
			  <option value=${programa.id}>${programa.proName}</option>
			#{/list}
	</select>
	</p>
	<div class="m2_b_c1">
	     	<div class="m2c_a">栏目名称：</div>
	        <div class="m2c_b"><input name="programa.proName" type="text"/></div>
	</div>
	<div class="m2_b_c1">
	     	<div class="m2c_a">信息代码：</div>
	        <div class="m2c_b"><input name="programa.proCode" type="text"/></div>
	</div>
	<p style="margin-left:245px;"><input type="submit" value="添加"></p>
</form>
<p><a href="/controllers/ProgramaAction.list">返回</a></p>
</div>